<template>
	<view class="content">
		<view class="content_title">通讯录标签</view>
		<view class="content_list">
			<view class="tab">测试</view>
		</view>
		<view class="content_text">
			<text>
				每个通讯录可设置20个标签，设置合适的标签，\n可以让更多群友找到您的通讯录。
			</text>
		</view>
		<view class="content_button" @click="showAdd = true">
			+添加标签
		</view>
		<view class="content_bottom">
			<view class="button">完成</view>
		</view>
		
		<view class="addBox" v-if="showAdd">
			<view class="bj" @click="showAdd = false"></view>
			<view class="box">
				<view class="top">
					<view class="text" @click="add">确认</view>
					<view class="text" @click="showAdd = false">取消</view>
				</view>
				<view class="input">
					<input v-model="addText" type="text" placeholder="输入标签名称"/>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		defineProps,
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	const showAdd = ref(false)
	const addText = ref('')
	const add = ()=>{
		if(addText.value == ''){
			uni.showToast({
				title: '输入标签名称',
				icon: 'none',
				duration: 2000
			});
			return
		}
		tabList.value.push({
			name:addText.value,
			is:false
		})
		showAdd.value = false
	}
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
		height: 100%;
		overflow-y: auto;
		background: #f5f6fa;
		&_title{
			width: calc(100% - 60rpx);
			padding: 30rpx;
			font-size: 32rpx;
			color: #999;
		}
		&_list{
			width: calc(100% - 60rpx);
			padding: 30rpx;
			background:#fff;
			display: flex;
			flex-wrap: wrap;
			.tab{
				font-size: 28rpx;
				padding: 10rpx 20rpx;
				border: 1px solid #ddd;
				border-radius: 8px;
				margin-left: 10rpx;
				margin-right: 10rpx;
			}
		}
		&_text{
			width: calc(100% - 60rpx);
			color: #999;
			font-size: 28rpx;
			padding: 30rpx;
		}
		&_button{
			width: calc(100% - 60rpx);
			height: 90rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #fff;
			font-size: 32rpx;
			background: #e94f06;
			margin: 0 auto;
			border-radius: 8px;
		}
		&_bottom{
			width: 100%;
			height: 100rpx;
			.button{
				width: 100%;
				height: 100rpx;
				position: fixed;
				bottom: 0;
				left: 0;
				background: #e94f06;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 38rpx;
			}
		}
	}
	.addBox{
		position: fixed;
		width: 100%;
		height: 100%;
		left: 0;
		top: 0;
		.bj{
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, .2);
		}
		.box{
			position: absolute;
			bottom: 0;
			left: 0;
			background: #fff;
			width: 100%;
			.top{
				width: calc(100% - 60rpx);
				padding: 30rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 32rpx;
				border-bottom: 1px solid #f5f6fa;
				.text:nth-child(1){
					color: #e94f06;
				}
				.text:nth-child(2){
					color: #555;
				}
			}
			.input{
				width: 100%;
				height: 200rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				padding-bottom: 100rpx;
				input{
					width: calc(100% - 120rpx);
					height: 40rpx;
					font-size: 32rpx;
					background: #eee;
					border-radius: 8px;
					padding: 30rpx;
				}
			}
		}
	}
</style>